package org.springframework.samples.mvc.test;

import org.springframework.mvc.extensions.flash.FlashMap.Message;
import org.springframework.mvc.extensions.flash.FlashMap.MessageType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.context.request.WebRequest;

@Controller
@RequestMapping(value="/test/simpleform")
public class SimpleFormController {
	
	@RequestMapping(method=RequestMethod.GET)
	public void simpleForm(WebRequest webRequest, Model model) {
		String msg = "init";
		model.addAttribute("message", new Message(MessageType.success, msg));
	}
	
	@RequestMapping(method=RequestMethod.POST)
	public void processSubmit(WebRequest webRequest, Model model) {
		String msg = "submited";
		model.addAttribute("message", new Message(MessageType.success, msg));
	}
	

}
